(function(){
  // 获取元素
  const username=  document.querySelector('#username')
  const password=  document.querySelector('#password')
  const phone=  document.querySelector('#phone')
  const question=  document.querySelector('#question')
  const answer=  document.querySelector('#answer')

    
  $('form').on('submit',function(e){
    e.preventDefault()


    $.ajax({
      method:'POST',
      url:'http://124.223.14.236:3001/api/user/reg',
      data:{
        username:username.value,
        password:password.value,
        phone:phone.value,
        sex:1,
        description: '今天又是新的一天',
        vip:1,
        question:question.value,
        answer:answer.value,
      },
      success(res){
        console.log(res.data);
      }
    })
  })

})();